package com.sk.bilibili.view.activity;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.sk.bilibili.R;
import com.sk.bilibili.config.GlideApp;
import com.sk.bilibili.databinding.ActivityFlashBinding;
import com.sk.bilibili.model.activity.FlashModel;

public class FlashActivity extends BaseActivity<ActivityFlashBinding, FlashModel> {

    @Override
    protected void afterSetView() {
        model.getFlash();
        model.requestPermissions();
    }

    @Override
    protected void beforeSetView() {
        model.initThem();
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCode == 2233) model.waitAndLogin();
    }

    public void setFlash(String url) {
        GlideApp.with(this).load(url).flash().into(bind.getRoot());
    }

    public void loginError() {
        startActivity(LoginActivity.class, true);
    }

    public void loginSuccess() {
        startActivity(MainActivity.class, true);
    }

}